from itsdangerous import URLSafeTimedSerializer
from meiduo_mall.settings import dev

def generic_openid(openid :str):
    s = URLSafeTimedSerializer(secret_key=dev.SECRET_KEY)
    access_token = s.dumps(openid)
    return access_token

def check_access_token(access_token):
    s = URLSafeTimedSerializer(secret_key=dev.SECRET_KEY)
    try:
        result=s.loads(access_token)
    except Exception:
        return None
    else:
        return result